package com.xingkeduo.pojo.table;

import com.xingkeduo.pojo.dto.BaseDTO;
import com.xingkeduo.util.pojo.base.BaseEnum;
import com.xingkeduo.util.pojo.base.BaseTable;
import com.xingkeduo.util.tool.IdentityUtil;
import com.xingkeduo.util.tool.IdentityUtil.Worker;
import org.apache.ibatis.type.Alias;

import java.util.List;

/**
 * 一线员工账户类
 *
 * @author 高杰
 * @time 2018年12月24日 下午3:52:02
 * @description
 */
@Alias("Craftsman")
public class CraftsmanTO extends BaseTable<CraftsmanTO> {
    public enum Status implements BaseEnum {
        ELIMINATE(10, "已淘汰"),
        RESERVE(20, "已储备"),//取消需求
        STUDENT(30, "学员"),
        FLOW(40, "飞虎队"),
        BIND(50, "绑定"),//发型师
        LEAVE(60, "离职"),
        BACK(70, "召回");

        private int value;
        private String desc;

        private Status(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static boolean validValue(String value) {
            int value_int = Integer.parseInt(value);
            return validValue(value_int);
        }

        public static boolean validValue(int value) {
            Status[] statuses = Status.values();
            for (int i = 0; i < statuses.length; i++) {
                if (statuses[i].getValue() == value)
                    return true;
            }
            return false;
        }

        public static Status getStatus(String value) {
            int value_int = Integer.parseInt(value);
            return getStatus(value_int);
        }

        public static Status getStatus(int value) {
            Status[] statuses = Status.values();
            for (int i = 0; i < statuses.length; i++) {
                if (statuses[i].getValue() == value)
                    return statuses[i];
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getDesc() {
            return desc;
        }
    }

    public enum Type implements BaseEnum {
        HAIRCUT(1, "发型师");

        private int value;
        private String desc;

        private Type(int value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static boolean validValue(String value) {
            int value_int = Integer.parseInt(value);
            return validValue(value_int);
        }

        public static boolean validValue(int value) {
            Type[] types = Type.values();
            for (int i = 0; i < types.length; i++) {
                if (types[i].getValue() == value)
                    return true;
            }
            return false;
        }

        public static Type getType(String value) {
            int value_int = Integer.parseInt(value);
            return getType(value_int);
        }

        public static Type getType(int value) {
            Type[] types = Type.values();
            for (int i = 0; i < types.length; i++) {
                if (types[i].getValue() == value)
                    return types[i];
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getDesc() {
            return desc;
        }
    }

    private String login;
    private String password;
    private Status status;
    private Integer registerStep;
    private Type type;

    private Status leaveStatus;
    private CraftsmanJobTO job;
    private CraftsmanSocialTO social;
    private CraftsmanDutyTO duty;
    private List<JobseekerAssessTO> assesses;
    private List<CraftsmanTraceTO> traces;
    private CraftsmanLeavingTO leaving;
    private List<CraftsmanHistoryTO> historys;

    //附件
    private List<CraftsmanFileTO> files;
    //健康证信息
    private List<CraftsmanHealthTO> healthList;

    //健康证对象
    private CraftsmanHealthTO healthTO;

    private CraftsmanLevelTO craftsmanLevelTO;
    private List<BaseDTO> companyDTOList;

    private JobseekerJobTO jobseekerJobTO;
    private CraftsmanShopTO craftsmanShop;

    private List<CraftsmanServiceTO> craftsmanServiceList;
    //求职者信息
    private JobseekerTO jobseekerTO;

    private List<BaseDTO> shopList;
    private BaseDTO shopDTO;

    private List<Long> shopIds;

    public Status getLeaveStatus() {
        return leaveStatus;
    }

    public CraftsmanTO setLeaveStatus(Status leaveStatus) {
        this.leaveStatus = leaveStatus;
        return this;
    }

    public List<CraftsmanServiceTO> getCraftsmanServiceList() {
        return craftsmanServiceList;
    }

    public void setCraftsmanServiceList(List<CraftsmanServiceTO> craftsmanServiceList) {
        this.craftsmanServiceList = craftsmanServiceList;
    }

    public CraftsmanHealthTO getHealthTO() {
        return healthTO;
    }

    public CraftsmanTO setHealthTO(CraftsmanHealthTO healthTO) {
        this.healthTO = healthTO;
        return this;
    }

    public JobseekerTO getJobseekerTO() {
        return jobseekerTO;
    }

    public CraftsmanTO setJobseekerTO(JobseekerTO jobseekerTO) {
        this.jobseekerTO = jobseekerTO;
        return this;
    }

    public List<BaseDTO> getShopList() {
        return shopList;
    }

    public CraftsmanTO setShopList(List<BaseDTO> shopList) {
        this.shopList = shopList;
        return this;
    }

    private List<CraftsmanFileTO> pictureGrounp;

    public List<CraftsmanFileTO> getPictureGrounp() {
        return pictureGrounp;
    }

    public CraftsmanTO setPictureGrounp(List<CraftsmanFileTO> pictureGrounp) {
        this.pictureGrounp = pictureGrounp;
        return this;
    }

    public BaseDTO getShopDTO() {
        return shopDTO;
    }

    public CraftsmanTO setShopDTO(BaseDTO shopDTO) {
        this.shopDTO = shopDTO;
        return this;
    }

    public CraftsmanShopTO getCraftsmanShop() {
        return craftsmanShop;
    }

    public void setCraftsmanShop(CraftsmanShopTO craftsmanShop) {
        this.craftsmanShop = craftsmanShop;
    }

    public JobseekerJobTO getJobseekerJobTO() {
        return jobseekerJobTO;
    }

    public void setJobseekerJobTO(JobseekerJobTO jobseekerJobTO) {
        this.jobseekerJobTO = jobseekerJobTO;
    }

    public List<Long> getShopIds() {
        return shopIds;
    }

    public CraftsmanTO setShopIds(List<Long> shopIds) {
        this.shopIds = shopIds;
        return this;
    }

    public List<BaseDTO> getCompanyDTOList() {
        return companyDTOList;
    }

    public CraftsmanTO setCompanyDTOList(List<BaseDTO> companyDTOList) {
        this.companyDTOList = companyDTOList;
        return this;
    }

    public CraftsmanLevelTO getCraftsmanLevelTO() {
        return craftsmanLevelTO;
    }

    public CraftsmanTO setCraftsmanLevelTO(CraftsmanLevelTO craftsmanLevelTO) {
        this.craftsmanLevelTO = craftsmanLevelTO;
        return this;
    }

    public List<CraftsmanFileTO> getFiles() {
        return files;
    }

    public List<CraftsmanHealthTO> getHealthList() {
        return healthList;
    }

    public CraftsmanTO setHealthList(List<CraftsmanHealthTO> healthList) {
        this.healthList = healthList;
        return this;
    }

    public CraftsmanTO setFiles(List<CraftsmanFileTO> files) {
        this.files = files;
        return this;
    }

    public Integer getRegisterStep() {
        return registerStep;
    }

    public CraftsmanTO setRegisterStep(Integer registerStep) {
        this.registerStep = registerStep;
        return this;
    }

    public CraftsmanDutyTO getDuty() {
        return duty;
    }

    public void setDuty(CraftsmanDutyTO duty) {
        this.duty = duty;
    }

    public String getLogin() {
        return login;
    }

    public CraftsmanTO setLogin(String login) {
        this.login = login;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public CraftsmanTO setPassword(String password) {
        this.password = password;
        return this;
    }

    public Status getStatus() {
        return status;
    }

    public CraftsmanTO setStatus(Status status) {
        this.status = status;
        return this;
    }

    public Type getType() {
        return type;
    }

    public CraftsmanTO setType(Type type) {
        this.type = type;
        return this;
    }

    public CraftsmanJobTO getJob() {
        return job;
    }

    public CraftsmanTO setJob(CraftsmanJobTO job) {
        this.job = job;
        return this;
    }

    public CraftsmanSocialTO getSocial() {
        return social;
    }

    public CraftsmanTO setSocial(CraftsmanSocialTO social) {
        this.social = social;
        return this;
    }

    public List<JobseekerAssessTO> getAssesses() {
        return assesses;
    }

    public CraftsmanTO setAssesses(List<JobseekerAssessTO> assesses) {
        this.assesses = assesses;
        return this;
    }

    public List<CraftsmanTraceTO> getTraces() {
        return traces;
    }

    public CraftsmanTO setTraces(List<CraftsmanTraceTO> traces) {
        this.traces = traces;
        return this;
    }

    public List<CraftsmanHistoryTO> getHistorys() {
        return historys;
    }

    public CraftsmanTO setHistorys(List<CraftsmanHistoryTO> historys) {
        this.historys = historys;
        return this;
    }

    public CraftsmanLeavingTO getLeaving() {
        return leaving;
    }

    public CraftsmanTO setLeaving(CraftsmanLeavingTO leaving) {
        this.leaving = leaving;
        return this;
    }

    public static CraftsmanTO build() {
        return new CraftsmanTO().initId(IdentityUtil.nextId(Worker.USER));
    }

    public CraftsmanTO copy(JobseekerTO jobseeker) {
        this.setLogin(jobseeker.getLogin()).setPassword(jobseeker.getPassword()).setStatus(Status.STUDENT);
        if (jobseeker.getType() == JobseekerTO.Type.HAIRCUT)
            this.setType(Type.HAIRCUT);

        return this;
    }

    public void reset(JobseekerTO.Type type) {
        this.setStatus(Status.STUDENT);
        if (type == JobseekerTO.Type.HAIRCUT)
            this.setType(Type.HAIRCUT);
    }

    @Override
    public String toString() {
        return "CraftsmanTO{" +
                "login='" + login + '\'' +
                ", password='" + password + '\'' +
                ", status=" + status +
                ", registerStep=" + registerStep +
                ", type=" + type +
                ", job=" + job +
                ", social=" + social +
                ", duty=" + duty +
                ", assesses=" + assesses +
                ", traces=" + traces +
                ", leaving=" + leaving +
                ", historys=" + historys +
                ", files=" + files +
                ", healthList=" + healthList +
                ", craftsmanLevelTO=" + craftsmanLevelTO +
                ", companyDTOList=" + companyDTOList +
                '}';
    }
}
